package ms.unicorn.erml.figures;

import ms.unicorn.erml.edit.parts.ContainerEntityEditPart;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;

public class ActorCompartmentPaneFigure extends NodeFigure {

	private Insets insets;
	private ContainerEntityEditPart editPart;

	public ActorCompartmentPaneFigure(ContainerEntityEditPart editPart) {
		this.editPart = editPart;
	}
	
	@Override
	protected void paintFigure(Graphics graphics) {
		if (!isVisible() || editPart.isCollapsed())
			return;
		Rectangle rect = getBounds().getCopy();
		rect.crop(getInsets());
		graphics.drawRoundRectangle(rect, 20, 20);
	}

	public void setInsets(Insets insets) {
		this.insets = insets;
	}
	
	@Override
	public Insets getInsets() {
		if (insets != null)
			return insets;
		return super.getInsets();
	}

	
}
